/* When creating turfs its a simple process of having the name
	then setting its icon and its icon_state. they can then be put down onto the
	map.dmp
*/

turf
	var
		climable
		destx
		desty
		destz
		dest
		down     //Down = 1 if they're climbing down something
	text = "<font bgcolor=black> </font>"
	Click()
		if (usr.modeteleoport)
			Teleport(usr,src)
		if (usr.modefiresomething)
			return

	inventory
		icon = 'inventory.dmi'
		slots
			name = ""
			part1
				icon_state = "1"
			part2
				icon_state = "2"
			part3
				icon_state = "3"
			part4
				icon_state = "4"
			part5
				icon_state = "5"
			part6
				icon_state = "6"
			part7
				icon_state = "7"
			guy
				icon = 'inventoryguy.PNG'

	icon = 'turf.dmi'
	floor // general floor, white with black speckles
		icon_state = "floor"
		text = "<font bgcolor=#999999> </font>"
	bfloor // Blue floor for inside rooms
		icon_state = "bfloor"
		text = "<font bgcolor=#CCFFFF> </font>"
	door
		icon_state = "dclosed"
		density = 1
		Click()
			if (density)
				src.icon_state = "dopen"
				src.density = 0
			else
				src.icon_state = "dclosed"
				src.density = 1

	wall
		density = 1
		text = "<font bgcolor=#777777> </font>"
		icon_state = "wall"
		full
			icon_state = "wall"
			opacity = 1
		topleft
			icon_state = "tl"
		topright
			icon_state = "tr"
		toprightish
			icon_state = "tr"
		bottomleft
			icon_state = "bl"
		bottomright
			icon_state = "br"
		stairs

			upstairs
				icon_state = "stairsup"
			downstairs
				icon_state = "stairsdown"

	grid
		icon_state = "grid"
		density = 1

	outside
		helper_sign
			icon = 'pc npc.dmi'
			icon_state = "helper2"
		houses
			text = "<font bgcolor=#002244>#</font>"
			density = 1
			smallhut
				name = "Small hut"
				ne
					icon_state = "hut2"
				nw
					icon_state = "hut3"
				se
					icon_state = "hut4"
				sw
					icon_state = "hut1"
			burninatedsmallhut
				name = "Burninated Small hut"
				ne
					icon_state = "firehouse21"
				nw
					icon_state = "firehouse23"
				se
					icon_state = "firehouse24"
				sw
					icon_state = "firehouse22"
			bighut
				name = "Big Hut"
				ne
					icon_state = "hut21"
				n
					icon_state = "hut22"
				nw
					icon_state = "hut23"
				w
					icon_state = "hut24"
				sw
					icon_state = "hut25"
				s
					icon_state = "hut26"
				se
					icon_state = "hut27"
				e
					icon_state = "hut28"
				cen
					icon_state = "hut29"
					text = "<font bgcolor=#113355> </font>"
			farm
				name = "Ruined old house"
				ne
					icon_state = "farm1"
				n
					icon_state = "farm2"
				nw
					icon_state = "farm3"
				w
					icon_state = "farm4"
				sw
					icon_state = "farm5"
				s
					icon_state = "farm6"
				se
					icon_state = "farm7"
				e
					icon_state = "farm8"
				meh
					icon_state = "farm9"
					density = 0
					Entered(atom/A)
						if(ismob(A))
							if(istype(A,/mob/pc))
								var/mob/pc/M = A
								if(!M.seenfarm)
									M.Locked = 1
									var/Page/P = FindPage("TheFarm")
									P.DisplayPage(M)
									M.seenfarm = 1
								else
									return


				cen
					icon_state = "farm99"
					text = "<font bgcolor=#113355> </font>"

			burnbighut
				name = "Burninated Big Hut"
				ne
					icon_state = "firehouse1"
				n
					icon_state = "firehouse2"
				nw
					icon_state = "firehouse3"
				w
					icon_state = "firehouse4"
				sw
					icon_state = "firehouse5"
				s
					icon_state = "firehouse6"
				se
					icon_state = "firehouse7"
				e
					icon_state = "firehouse8"
				cen
					icon_state = "firehouse9"
					text = "<font bgcolor=#113355> </font>"

			church
				name = "Church"
				a1
					icon_state = "chu1"
				a2
					icon_state = "chu2"
					density = 0
					text = "<font bgcolor=#113355> </font>"
					Entered(atom/A)
						if(istype(A,/mob/pc))
							var/mob/pc/M = A
							M.Locked = 1
							var/Page/P = FindPage("TempleOfOdin")
							P.DisplayPage(M)
				a3
					icon_state = "chu3"
				a4
					icon_state = "chu4"
				a5
					icon_state = "chu5"
				a6
					icon_state = "chu6"
				a7
					icon_state = "chu7"
				a8
					icon_state = "chu8"
				a9
					icon_state = "chu9"
				a10
					icon_state = "chu10"
				a11
					icon_state = "chu11"
				a12
					icon_state = "chu12"
				a13
					icon_state = "chu13"
				a14
					icon_state = "chu14"
			burnedchurch
				name = "Burninated Church"
				a1
					icon_state = "firechurch1"
				a2
					icon_state = "firechurch2"
					density = 0
					text = "<font bgcolor=#113355> </font>"
				a3
					icon_state = "firechurch3"
				a4
					icon_state = "firechurch4"
				a5
					icon_state = "firechurch5"
				a6
					icon_state = "firechurch6"
				a7
					icon_state = "firechurch7"
				a8
					icon_state = "firechurch8"
				a9
					icon_state = "firechurch9"
				a10
					icon_state = "firechurch10"
				a11
					icon_state = "firechurch11"
				a12
					icon_state = "firechurch12"
				a13
					icon_state = "firechurch13"
				a14
					icon_state = "firechurch14"
				a15
					icon_state = "firechurch15"
				a16
					icon_state = "firechurch16"
				a17
					icon_state = "firechurch17"
		floor
			grass
				icon_state = "grass"
				text = "<font bgcolor=green>.</font>"
			gravel
				name = "Path"
				icon_state = "gravel"
				text = "<font bgcolor=brown>.</font>"
				ne
					icon_state = "gne"
				nw
					icon_state = "gnw"
				se
					icon_state = "gse"
				sw
					icon_state = "gsw"
				path
					icon_state = "path"
				path2
					icon_state = "path2"

			farmland
				icon_state = "farmland"
				density = 1
				text = "<font bgcolor=#227711>%</font>"
			farmland2
				layer = MOB_LAYER + 1
				icon_state = "farmland"
				name = "farmland"
				density = 0
				text = "<font bgcolor=#189920>%</font>"
			well
				icon_state = "well"
				text = "o"

			sign
				icon_state = "sign"
				text = "T"
				var/stext = "im muddy to read, clean me!"
				Click()
					usr << "This is a sign it reads [stext]"
			ssign
				icon_state = "sign"
				text = "T"
				Click()
					usr << "Children lovingly adopted and cared for: [worldplayers]"

			cart
				text = "&"
				icon_state = "cart"
				density = 1
			garden
				text = "#"
				icon_state = "garden"
				density = 1
			cart2
				text = "&"
				icon_state = "cart2"
				density = 1
			garden2
				text = "#"
				icon_state = "garden2"
				density = 1
			dungeon1entrance
				text = "*"
				icon_state = "entrance1"
				Entered(atom/A)
					if(istype(A,/mob/pc))
						var/mob/pc/M = A
						M.Teleport(locate(11,2,2))
			dungeonexit
				text ="*"
				icon_state = "gravel"
				Entered(atom/A)
					if(istype(A,/mob/pc))
						var/mob/pc/M = A
						M.Teleport(locate(51,86,1))
			fence
				density = 1
				fenceleft
					text = "<font color = white>-</font>"
					icon_state = "fence1"
				fencecenterdense
					text = "<font color = white>-</font>"
					icon_state = "fence2"
					density = 1
				fencecenterdense2
					text = "<font color = white>|</font>"
					icon_state = "fence4"
					density = 1
				fencecent
					density = 0
					icon_state = "fence2"
					text = "<font color = white>=</font>"
					Entered(atom/A)
						if(istype(A,/mob/pc))
							var/mob/pc/M = A
							M.Teleport(locate(36,49,1))

				fencecent2
					text = "<font color = white>=</font>"
					density = 0
					icon_state = "fence2"
					Entered(atom/A)
						if(istype(A,/mob/pc))
							var/mob/pc/M = A
							if(M.burn == 1)
								M.Teleport(locate(36,49,1))
								walk_to(M,M,0,2)
							else if(M.burn == 2)
								M << " You turn away, looking at the devastation makes you feel sick to the lowest depths of your stomache. You dare not return."
								return 0
							if(!M.burn)
								M.Teleport(locate(36,34,1))
								walk_to(M,M,0,2)

				fenceright
					icon_state = "fence3"
					text = "<font color = white>-</font>"
			Teleporttovillage2
				icon_state = "gravel"
				text = {"<font color = "white">I</font>"}
				Enter(atom/A)
					if(istype(A,/mob/pc))
						var/mob/pc/M = A
						if (M.gotoV2)
							M.Teleport(locate(36,49,1))//Village 2!
						else
							M << " You look at the highway vanishing in the distance, and feel no need to continue."
							step(M,EAST)
							return 0
			Firesmall
				icon_state ="minifire"
				density = 1
			Firebig
				icon = 'misc graphics.dmi'
				TL
					icon_state = "tl"
					layer = MOB_LAYER +1
				TR
					icon_state = "tr"
					layer = MOB_LAYER +1
				BL
					icon_state = "bl"
				BR
					icon_state = "br"

			mountain
				density = 1
				mount
					text = "<font bgcolor='#999999'> </font>"
					icon_state = "mount"
				mountl
					text = "<font bgcolor='#999999'> </font>"
					icon_state = "mountr"
				mountr
					text = "<font bgcolor='#999999'> </font>"
					icon_state = "mountl"
				mountf
					text = "<font bgcolor='#999999'> </font>"
					icon_state = "mountf"
				snowcappedbits
					snowl
						text = "<font bgcolor='#FFFFFF'> </font>"
						icon_state = "snowl"
					snowr
						text = "<font bgcolor='#FFFFFF'> </font>"
						icon_state = "snowr"
					snowc
						text = "<font bgcolor='#FFFFFF'> </font>"
						icon_state = "snowc"
					snow
						text = "<font bgcolor='#FFFFFF'> </font>"
						icon_state = "snow"
	logo
		icon = 'castlelogo.png'
//	grave
	//	icon = 'GRAVE.PNG'
	LoadChar
		icon = 'loadchar.png'
		name = "Load Character"
	NewChar
		icon = 'newchar.png'
		name = "New Character"

//Turf templates: used for Lay Turf
	template
		text = ""
		var
			teleportx as num
			teleporty as num
			teleportz as num
			stext
			open
		teleport
			Entered(var/atom/movable/O)
				O.Teleport(locate(teleportx,teleporty,teleportz))
		sign
			Click()
				usr << "This is a sign. It reads: [stext]"
		window
			density = 1
			opacity = 0
		opaque
			density = 0
			opacity = 1
		dense
			density = 1
			opacity = 1
		door
			icon_state = "dclosed"
			density = 1
			Click()
				if (src.density)
					src.icon_state = "dopen"
					src.density = 0

				else
					src.icon_state = "dclosed"
					src.density = 1
			dooropaque
				opacity = 1
				Click()
					if (src.density)
						src.icon_state = "dopen"
						src.density = 0
						src.opacity = 0

					else
						src.icon_state = "dclosed"
						src.density = 1
						src.opacity = 1
						src.open = !src.open

	alphabet
		New()
			name = ""
			..()
		a
			text = "<font color = white>a</font>"
		b
			text = "<font color = white>b</font>"
		c
			text = "<font color = white>c</font>"
		d
			text = "<font color = white>d</font>"
		e
			text = "<font color = white>e</font>"
		f
			text = "<font color = white>f</font>"
		g
			text = "<font color = white>g</font>"
		h
			text = "<font color = white>h</font>"
		i
			text = "<font color = white>i</font>"
		j
			text = "<font color = white>j</font>"
		k
			text = "<font color = white>k</font>"
		l
			text = "<font color = white>l</font>"
		m
			text = "<font color = white>m</font>"
		n
			text = "<font color = white>n</font>"
		o
			text = "<font color = white>o</font>"
		p
			text = "<font color = white>p</font>"
		q
			text = "<font color = white>q</font>"
		r
			text = "<font color = white>r</font>"
		s
			text = "<font color = white>s</font>"
		t
			text = "<font color = white>t</font>"
		u
			text = "<font color = white>u</font>"
		v
			text = "<font color = white>v</font>"
		w
			text = "<font color = white>w</font>"
		x
			text = "<font color = white>x</font>"
		y
			text = "<font color = white>y</font>"
		z
			text = "<font color = white>z</font>"
		ex
			text = "<font color = white>!</font>"
		colours
			green
				text = "<font bgcolor=#007600> </font>"
			green2
				text = "<font bgcolor=#00bb00> </font>"
			blue
				density = 1
				text = "<font bgcolor=#000055> </font>"
			blue2
				text = "<font bgcolor=#0000ff> </font>"
//	Front_New
//		name = ""
//		icon = 'cotwtitle2.png'


area
	newc
		Click()
			var/mob/pc/P = usr
			if(!usr.ClickedNew)
				if(P.PlayerIsSaved(usr))
					switch(alert("[usr], you already have an existing character. Do you want to delete it?","New Character","Yes","No"))
						if("Yes")
							P.DeletePlayer(usr)
						if("No")
							return 0
				usr.ClickedNew = 1
				worldplayers ++
			//	Login_Form()

	load
		Click()
			if(!usr.ClickedNew)
				var/mob/pc/P = usr
				if(P.PlayerIsSaved(usr))
					usr.ClickedNew = 1
					P.LoadPlayer(usr)

	dancearea
		Enter(mob/M)
			if(ismob(M) && M.client)
				if(M.areain != src.type || !M.areain)
					dancing_peeps()
					M.areain = src.type
				else
					return..()
				return..()
	danceexitarea
		Enter(mob/M)
			if(ismob(M) && M.client)
				if(M.areain != src.type || !M.areain)
					M.areain = src.type
				else
					return..()
				return..()
